#include<bits/stdc++.h>
using namespace std;
const int N = 1e6+10;
int n, k, maxn, a[N], d[N];

int main(){
	cin >> n >> k;
	for(int i = 1;i <= n; i++)
	{
	    cin >> a[i];
    	d[i] += a[i] + d[i-1];
    }
    for(int i = 1; i <= n-k; i++)
    {
    	maxn = max(maxn, d[i+k]-d[i-1]);
    }
	cout << maxn;
	return 0; 
}